import Main from '@/views/Main.vue';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: () => import('@/views/login.vue')
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404-页面不存在'
    },
    component: () => import('@/views/error-page/404.vue')
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403-权限不足'
    },
    name: 'error-403',
    component: () => import('@//views/error-page/403.vue')
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error-500',
    component: () => import('@/views/error-page/500.vue')
};

export const preview = {
    path: '/preview',
    name: 'preview',
    component: () => import('@/views/form/article-publish/preview.vue')
};

export const locking = {
    path: '/locking',
    name: 'locking',
    component: () => import('@/views/main-components/lockscreen/components/locking-page.vue')
};


// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
        { path: 'home', title: {i18n: 'home'}, name: 'home_index', component: () => import('@/views/home/home.vue') },
        { path: 'ownspace', title: '个人中心', name: 'ownspace_index', component: () => import('@/views/own-space/own-space.vue') },
        { path: 'order/:order_id', title: '订单详情', name: 'order-info', component: () => import('@/views/advanced-router/component/order-info.vue') }, // 用于展示动态路由
        { path: 'shopping', title: '购物详情', name: 'shopping', component: () => import('@/views/advanced-router/component/shopping-info.vue') }, // 用于展示带参路由
        { path: 'message', title: '消息中心', name: 'message_index', component: () => import('@/views/message/message.vue') },
        { path: 'ac-detail/:id', title: 'AC详情', name: 'ac-detail', component: () => import('@/views/performance/AC-detail.vue') },
        { path: 'ap-detail/:id', title: 'AP详情', name: 'ap-detail', component: () => import('@/views/performance/AP-detail.vue') },
        { path: 'client-detail/:id', title: '终端详情', name: 'client-detail', component: () => import('@/views/performance/client-detail.vue') },
        { path: 'serviceDevice-detail/:type/:id', title: '网络服务详情', name: 'serviceDevice-detail', component: () => import('@/views/performance/serviceDevice-detail.vue') },
        { path: 'event-add', title: '报告故障', name: 'event-add', component: () => import('@/views/event/add') },
        { path: 'event-check/:id', title: '检测故障', name: 'event-check', component: () => import('@/views/event/check') },
        { path: 'event-test/:id', title: '测试故障', name: 'event-test', component: () => import('@/views/event/test') },
        { path: 'event-finish/:id', title: '处理故障', name: 'event-finish', component: () => import('@/views/event/finish') },
        { path: 'wiki-detail/:id', title: '处理故障', name: 'wiki-detail', component: () => import('@/views/wiki/wiki-detail') },
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/topology',
        icon: 'android-share-alt',
        name: 'topology',
        title: '网络拓扑',
        component: Main,
        children: [
            { path: 'topology-chart', title: '网络拓扑', name: 'topology-chart', component: () => import('@/views/topology/topology.vue') }
        ]
    },
    {
        path: '/component',
        icon: 'stats-bars',
        name: 'component',
        title: '性能监控',
        component: Main,
        children: [
            {
                path: 'AC',
                name: 'AC',
                title: 'AC',
                component: () => import('@/views/performance/AC.vue')
            },
            {
                path: 'AP',
                name: 'AP',
                title: 'AP',
                component: () => import('@/views/performance/AP.vue')
            },
            {
                path: 'client',
                name: 'client',
                title: '终端',
                component: () => import('@/views/performance/client.vue')
            },
            {
                path: 'services',
                name: 'services',
                title: '网络服务',
                component: () => import('@/views/performance/services.vue')
            }
        ]
    },
    {
        path: '/event-handler',
        icon: 'wrench',
        name: 'event-handler',
        title: '故障处理',
        component: Main,
        children: [
            { path: 'event-management', title: '待处理故障', name: 'event-management', icon: 'clipboard', component: () => import('@/views/event/process.vue') },
            { path: 'event-history', title: '历史故障', name: 'event-history', icon: 'ios-box-outline', component: () => import('@/views/event/history.vue') }
        ]
    },
    {
        path: '/data-analysis',
        icon: 'pie-graph',
        name: 'advanced-router',
        title: '数据分析',
        component: Main,
        children: [
            { path: 'analysis-router', title: '全网状态', name: 'analysis-router', icon: 'network', component: () => import('@/views/analysis/network.vue') },
            // { path: 'analysis-AC', title: 'AC状态', name: 'analysis-AC', icon: 'monitor', component: () => import('@/views/analysis/AC.vue') },
            // { path: 'analysis-devices', title: 'AP状态', name: 'analysis-devices', icon: 'social-rss', component: () => import('@/views/analysis/AP.vue') },
            // { path: 'analysis-clients', title: '终端状态', name: 'analysis-clients', icon: 'iphone', component: () => import('@/views/analysis/client.vue') },
            { path: 'analysis-evnets', title: '报障记录', name: 'analysis-events', icon: 'document-text', component: () => import('@/views/analysis/event.vue') },
            { path: 'analysis-stats', title: '统计列表', name: 'analysis-stats', icon: 'clipboard', component: () => import('@/views/analysis/stats.vue') },
        ]
    },
    {
        path: '/wiki',
        icon: 'android-compass',
        name: 'wiki',
        title: '知识库',
        component: Main,
        children: [
            { path: 'wiki-search', title: '知识库', name: 'wiki-search', component: () => import('@/views/wiki/wiki-search.vue') }
        ]
    },
    {
        path: '/access',
        icon: 'key',
        name: 'access',
        title: '权限管理',
        component: Main,
        children: [
            { path: 'access-role', title: '角色管理', name: 'access-role', icon: 'ios-people', component: () => import('@/views/access/role.vue') },
            { path: 'access-user', title: '用户管理', name: 'access-user', icon: 'ios-person', component: () => import('@/views/access/user.vue') }
        ]
    },
    // {
    //     path: '/access-test',
    //     icon: 'lock-combination',
    //     title: '权限测试页',
    //     name: 'accesstest',
    //     access: 0,
    //     component: Main,
    //     children: [
    //         { path: 'index', title: '权限测试页', name: 'accesstest_index', access: 0, component: () => import('@/views/access/access-test.vue') }
    //     ]
    // },
    // {
    //     path: '/international',
    //     icon: 'earth',
    //     title: {i18n: 'international'},
    //     name: 'international',
    //     component: Main,
    //     children: [
    //         { path: 'index', title: {i18n: 'international'}, name: 'international_index', component: () => import('@/views/international/international.vue') }
    //     ]
    // },
    // {
    //     path: '/form',
    //     icon: 'android-checkbox',
    //     name: 'form',
    //     title: '表单编辑',
    //     component: Main,
    //     children: [
    //         { path: 'artical-publish', title: '文章发布', name: 'artical-publish', icon: 'compose', component: () => import('@/views/form/article-publish/article-publish.vue') },
    //         { path: 'workflow', title: '工作流', name: 'workflow', icon: 'arrow-swap', component: () => import('@/views/form/work-flow/work-flow.vue') }

    //     ]
    // },
    // {
    //     path: '/charts',
    //     icon: 'ios-analytics',
    //     name: 'charts',
    //     title: '图表',
    //     component: Main,
    //     children: [
    //         { path: 'pie', title: '饼状图', name: 'pie', icon: 'ios-pie', component: resolve => { require('@/views/access/access.vue') },
    //         { path: 'histogram', title: '柱状图', name: 'histogram', icon: 'stats-bars', component: resolve => { require('@/views/access/access.vue') }

    //     ]
    // },
    // {
    //     path: '/tables',
    //     icon: 'ios-grid-view',
    //     name: 'tables',
    //     title: '表格',
    //     component: Main,
    //     children: [
    //         { path: 'dragableTable', title: '可拖拽排序', name: 'dragable-table', icon: 'arrow-move', component: () => import('@/views/tables/dragable-table.vue') },
    //         { path: 'editableTable', title: '可编辑表格', name: 'editable-table', icon: 'edit', component: () => import('@/views/tables/editable-table.vue') },
    //         { path: 'searchableTable', title: '可搜索表格', name: 'searchable-table', icon: 'search', component: () => import('@/views/tables/searchable-table.vue') },
    //         { path: 'exportableTable', title: '表格导出数据', name: 'exportable-table', icon: 'code-download', component: () => import('@/views/tables/exportable-table.vue') },
    //         { path: 'table2image', title: '表格转图片', name: 'table-to-image', icon: 'images', component: () => import('@/views/tables/table-to-image.vue') }
    //     ]
    // }
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    preview,
    locking,
    ...appRouter,
    page500,
    page403,
    page404
];
